import request from 'utils/request'

/*
    发票管理
*/
let config = {
    headers: {
        'Content-Type': 'application/json;charset=UTF-8' //之前说的以表单传数据的格式来传递fromdata
    }
}

//更新发票并设置为默认
export const save = (params) => request.post('/p/saveInvoice', params, config)

//发票信息翻页
export const invoicePage = (params) => request.post('/p/getInvoice', params)
export const invoice = {
    getApplyInvoiceInitInfo: (data) => request.get('/p/getApplyInvoiceInitInfo', data), //获取申请开票初始信息
    getUserInvoiceTitle: (data) => request.get('/p/getUserInvoiceTitles', data), //获取用户发票抬头
    saveUserInvoiceTitle: (data) => request.post('/p/saveUserInvoiceTitles', data), //保存/编辑用户发票抬头
    applyInvoice: (data) => request.post('/p/applyInvoice', data, config), //用户申请开票
    getInvoiceDetail: (data) => request.get(`/p/getInvoiceDetail/${data}`), //获取发票详情
    cancelApply: (data) => request.post(`/p/cancelApplyInvoice/${data}`, config), //撤销开票申请
    updateInvoice: (data) => request.post(`/p/updateInvoice/`, data,config) //用户修改发票申请
}
